import { ref } from 'vue';

type Message = {
  show: boolean;
  content: string;
};
export const messageConfig = ref<Message>({
  show: false,
  content: '',
});
let clearFlag: any = 0;
export const message = (msg: string) => {
  messageConfig.value.content = msg;
  messageConfig.value.show = true;
  clearTimeout(clearFlag);
  clearFlag = setTimeout(() => {
    messageConfig.value.show = false;
  }, 3000);
};
